﻿using BaseUI;
using BLL;
using System;
using System.Data;
using System.Web.UI;

namespace Thksoft.Module.ProjectDetails
{
    public partial class IncomeBusinessCount : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
            }
            Bind(0, 0, "主营业务收入明细表");
        }

        public void Bind(decimal applyId, decimal applyState, string applyType)
        {
            var sql = "SELECT T1.C_VALUE2 AS C_INDEX,T1.C_VALUE3 AS C_NAME,T1.C_VALUE4 AS SaleNumber,T1.C_VALUE5 AS UnitePrice,T1.C_VALUE6 AS SumPrice,T1.C_VALUE7 AS Flow,T1.C_VALUE8 AS Remark,T1.C_VALUE9 AS ParentIndex FROM QS_PLAN_DETAILS T1 WHERE 1=1";
            if (applyId != 0)
            {
                sql += " AND T1.N_PLAN_ID=" + applyId;
            }
            if (applyState != 0)
            {
                sql += " AND T1.N_STATE=" + applyState;
            }
            sql += " AND T1.C_VALUE1='" + applyType + "'";
            sql += " ORDER BY T1.C_VALUE2";
            DataTable dt = new BaseBLL().Query(sql);

            grvShow1.DataSource = dt;
            grvShow1.DataBind();
        }
    }
}